﻿using Microsoft.AspNetCore.Mvc;
using SmartHotel.AccommodationSetting.Dto;
using SmartHotel.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace SmartHotel.AccommodationSetting
{
    [ApiExplorerSettings(GroupName ="v2")]
    public class SmartHotelAppAccommodationSettingService : ApplicationService,ISmartHotelAppAccommodationSettingService
    {
        public SmartHotelAppAccommodationSettingService(IRepository<AccommodationSettingTable,int> Accommodation)
        {
            this.Accommodation = Accommodation;
        }

        public IRepository<AccommodationSettingTable, int> Accommodation { get; }
        /// <summary>
        /// 住宿设置添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task<ResultDto<CrateandUpdateAccommodationSettingDto>> AddAccommodationSetting(CrateandUpdateAccommodationSettingDto dto)
        {
            var list = ObjectMapper.Map<CrateandUpdateAccommodationSettingDto, AccommodationSettingTable>(dto);
            await Accommodation.InsertAsync(list);
            return new ResultDto<CrateandUpdateAccommodationSettingDto> { Code = Result.Success ,Message="添加成功"};
        }
    }
}
